From e60074cecf9c912fa5542cfafd431ac681f8d900 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=BDeljko=20Filipin?= Date: Fri, 9 Jun 2017 15:40:31 +0200 Subject: [PATCH] WebdriverIO should be able to run Chrome headlessly Chrome 59 introduced an headless mode, in this mode it does not need any DISPLAY (Xorg, Xvfb...). That achieved by passing to chrome: --headless Use headless when DISPLAY is not available. One can switch to headless by simply unsetting the environment variable: unset(DISPLAY). Bug: T167507 Signed-off-by: Antoine Musso Change-Id: Id5424eafb20112fd74d472b8cef02cb15cafff89 --- tests/selenium/README.md | 5 +++++ tests/selenium/wdio.conf.js | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/selenium/README.md b/tests/selenium/README.md index 2dbf27140a..b15d4073dc 100644 --- a/tests/selenium/README.md +++ b/tests/selenium/README.md @@ -21,6 +21,11 @@ Set up MediaWiki-Vagrant: npm run selenium +By default, Chrome will run in headless mode. If you want to see Chrome, set DISPLAY +environment variable to any value: + + DISPLAY=:1 npm run selenium + To run only one file (for example page.js), you first need to spawn the chromedriver: chromedriver --url-base=wd/hub --port=4444 diff --git a/tests/selenium/wdio.conf.js b/tests/selenium/wdio.conf.js index 5eba0e0b9c..f253d45d42 100644 --- a/tests/selenium/wdio.conf.js +++ b/tests/selenium/wdio.conf.js @@ -84,9 +84,10 @@ exports.config = { maxInstances: 1, // browserName: 'chrome', - // Since Chrome v57 https://bugs.chromium.org/p/chromedriver/issues/detail?id=1625 chromeOptions: { - args: [ '--enable-automation' ] + // Run headless when there is no DISPLAY + // --headless: since Chrome 59 https://chromium.googlesource.com/chromium/src/+/59.0.3030.0/headless/README.md + args: process.env.DISPLAY ? [] : [ '--headless' ] } } ], // -- 2.20.1